import {Panel} from 'comps/common';
import TracingDetailList from '../components/tracing-detail-list';
import {fetchTracingDetailList} from 'actions/service';
import { getFetchStatus } from 'actions/util';
import * as React from 'react';
import * as ReactRedux from 'react-redux';

const mapStateToProps = (state) => {
  return {
    isFetching: getFetchStatus(state, fetchTracingDetailList),
    tracingDetailList: state.tracingDetailList
  };
};

const mapDispatchToProps = (dispatch) => {
  return {
    initFetch: (serviceId, rootId) => {
      dispatch(fetchTracingDetailList(serviceId, rootId));
    }
  };
};

class TracingDetail extends React.Component {

  componentDidMount() {
    this.props.initFetch(this.props.serviceId, this.props.rootId);
  }

  render() {
    return (
      <TracingDetailList {...this.props}/>
    )
  }
}

export default ReactRedux.connect(mapStateToProps, mapDispatchToProps)(TracingDetail);
